package com.work.demo.test;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class WareNodeParamDTO {

    /**
     * 是否是owner节点(所有状态都需要同步给owner)
     */
    private Boolean isOwner;

    /**
     * 节点信息
     */
    private NodeInfo node;

    /**
     * ""：无数据 "Y":Y方 "X":X方
     */
    @Deprecated
    private String dataType;

    private String supportVersion;

    /**
     * 用于传递其他节点的extraInfo
     */
    private JSONObject extraInfo;

    @Data
    public static class NodeInfo {

        /**
         * 节点nid
         */
        private String nid;

        /**
         * 公钥
         */
        private String pubkey;

        /**
         * 序号id
         */
        private Long serialId;

        /**
         * 服务地址
         */
        private String service;

        public Long getSerialId() {
            return serialId == null ? -1 : serialId;
        }
    }


}
